CREATE Procedure sp_Target_SelectFromCode
(
	@TAR_CODE varchar(255)
)
AS
BEGIN
    SELECT TAR_ID,TAR_CODE,TAR_DESCRIPTION
	FROM TARGET
	WHERE TAR_CODE=@TAR_CODE
END

GO

CREATE Procedure sp_Target_InitEquivalences
(
	@TAR_ID uniqueidentifier
)
AS
BEGIN
	if exists(select TAR_ID from TARGET where TAR_ID=@TAR_ID)
	BEGIN
		insert METATYPE_EQUIVALENCES (TAR_ID,MET_ID,MET_EQU_TYPE)
			select @TAR_ID,MET_ID,''
			from METATYPE
	END
END

GO